//
//  CellOneImg.m
//  News
//
//  Created by lanou3g on 15/11/5.
//  Copyright © 2015年 songhaowen. All rights reserved.
//

#import "CellOneImg.h"
#import "UIImageView+WebCache.h"
#import "JQnewsModel.h"
@implementation CellOneImg

- (void)awakeFromNib {
  }

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}


//1.cell重用
+(instancetype)cellWithTableView:(UITableView*)tableView{
    static NSString *cell_id = @"flag";
    CellOneImg *cell = [tableView dequeueReusableCellWithIdentifier:cell_id];
    
    
    if (!cell) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"CellOneImg" owner:nil options:nil] lastObject ];
    }
    return cell;
}
//2.初始化
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
         [self createUI];//布局
    }
    return self;
}
-(void)createUI{
    self.commentsLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 57, 100, 25)];
    [self.content addSubview:self.commentsLabel];
    
}
-(void)setUiWith:(JQnewsModel *)model{
    [self.img sd_setImageWithURL:[NSURL URLWithString:model.imgsrc]];
    self.title.text = model.title;
    self.content.text = model.digest;
    self.commentsLabel.textColor = [UIColor grayColor];
    self.commentsLabel.text = model.ptime;
}


@end
